package com.huanong.service.impl;
/*
 *@Author:anran
 *@Date:2020/12/7
 *@Version 1.0
 */

import com.huanong.mapper.NewsMapper;
import com.huanong.pojo.NewWork;
import com.huanong.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class NewServiceImpl implements NewsService {

    @Autowired
    private NewsMapper newsMapper;

    @Override
    public List<NewWork> query() {
        return newsMapper.queryNewsWork();
    }

    @Override
    public NewWork queryById(Integer NkId) {
        return newsMapper.queryNewsWorkById(NkId);
    }

    @Override
    public int add(NewWork newWork) {
        newWork.setNkTime(new Date());
        return newsMapper.addNewsWork(newWork);
    }

    @Override
    public int delete(Integer NkId) {
        return newsMapper.deleteNewsWork(NkId);
    }

    @Override
    public int update(NewWork newWork) {
        newWork.setNkTime(new Date());
        return newsMapper.updateNewsWork(newWork);
    }
}
